-- 增加防御力
AddComponentPostInit('combat',function(self)
    local old_GetAttacked = self.GetAttacked
    function self:GetAttacked(attacker,damage,weapon,stimuli,spdamage,...)
        if self.inst.prefab and self.inst.prefab == 'yuemiheng' and self.inst.components.ymh_lv then
            local lv = self.inst.components.ymh_lv.lv_cur
            if lv and lv > 0 then
                local absorb = math.min(lv*TUNING.MOD_YUEMIHENG.AVATAR.YUEMIHENG.EXP.ABSORB_PER_LV,TUNING.MOD_YUEMIHENG.AVATAR.YUEMIHENG.EXP.ABSORB_MAX)
                if damage then
                    damage = damage * (1-absorb)
                end
            end
        end
        return old_GetAttacked(self,attacker,damage,weapon,stimuli,spdamage,...)
    end
end)
